package com.lanou.myapp.funny;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dllo on 16/1/12.
 */
public class FunnyFragmentAdapter extends FragmentPagerAdapter {
    private Context context;
    private ArrayList<Fragment> data;


    String title1 = "段子";
    String title2 = "图片";
    String title3 = "视频";

    String[] titles = {title1, title2, title3};

    public FunnyFragmentAdapter(FragmentManager fm, Context context, ArrayList<Fragment> data) {
        super(fm);
        this.context = context;
        this.data = data;
    }

    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

}
